﻿@namespace AntDesign
@inherits AntDomComponentBase

<div class="@this.ClassMapper.Class">
    <div class="ant-transfer-list @(Footer.Value!=null?FooterClass:"")" @onscroll="@(e=>HandleScroll(TransferDirection.Left,e))" style="@Style">
        <div class="ant-transfer-list-header">
            @if (ShowSelectAll)
            {
                <Checkbox Checked="_leftCheckAllState" Indeterminate="_leftCheckAllIndeterminate" Disabled="@Disabled" CheckedChange="@(checkedState => SelectAll(checkedState, TransferDirection.Left))" />

            }
            <span class="ant-transfer-list-header-selected">
                <span>@_leftCountText items</span>
                @if (Titles[0] != "")
                {
                    <span class="ant-transfer-list-header-title ng-star-inserted">@Titles[0]</span>
                }
            </span>
        </div>
        <div class="ant-transfer-list-body @(ShowSearch?"ant-transfer-list-body-with-search":"")">
            @if (ShowSearch)
            {
                <div class="ant-transfer-list-body-search-wrapper">
                    <div>
                        <Input Class="ant-transfer-list-search" Placeholder="请输入搜索内容" OnInput="@(e=>HandleSearch(e,TransferDirection.Left))" TValue="string" />
                        <span class="ant-transfer-list-search-action">
                            <span role="img" aria-label="search" class="anticon anticon-search">
                                <svg viewBox="64 64 896 896" focusable="false" class="" data-icon="search" width="1em" height="1em" fill="currentColor" aria-hidden="true"><path d="M909.6 854.5L649.9 594.8C690.2 542.7 712 479 712 412c0-80.2-31.3-155.4-87.9-212.1-56.6-56.7-132-87.9-212.1-87.9s-155.5 31.3-212.1 87.9C143.2 256.5 112 331.8 112 412c0 80.1 31.3 155.5 87.9 212.1C256.5 680.8 331.8 712 412 712c67 0 130.6-21.8 182.7-62l259.7 259.6a8.2 8.2 0 0011.6 0l43.6-43.5a8.2 8.2 0 000-11.6zM570.4 570.4C528 612.7 471.8 636 412 636s-116-23.3-158.4-65.6C211.3 528 188 471.8 188 412s23.3-116.1 65.6-158.4C296 211.3 352.2 188 412 188s116.1 23.2 158.4 65.6S636 352.2 636 412s-23.3 116.1-65.6 158.4z"></path></svg>
                            </span>
                        </span>
                    </div>
                </div>
            }
            <ul class="ant-transfer-list-content ng-star-inserted">
                @if (!_leftDataSource.Any())
                {
                    <Empty Image="Empty.PRESENTED_IMAGE_SIMPLE" Small />
                }
                else
                {
                    foreach (var item in _leftDataSource)
                    {
                        <li @key="item" class="ant-transfer-list-content-item ng-star-inserted @(item.Disabled || Disabled ? DisabledClass : "")">
                            <Checkbox Label="@item.Key" Checked="_sourceSelectedKeys.Contains(item.Key)" CheckedChange="@(checkedState => SelectItem(checkedState, TransferDirection.Left, item.Key))" Disabled="@(item.Disabled || Disabled)">
                                @if (Render == null)
                                {
                                    @item.Title
                                }
                                else
                                {
                                    var _text = Render(item);
                                    @if (_text.IsT0)
                                    {

                                        @_text.AsT0
                                    }
                                    else
                                    {
                                        @_text.AsT1
                                    }
                                }
                            </Checkbox>
                        </li>
                    }
                }
            </ul>
        </div>
        <div class="ant-transfer-list-footer">
            @if (Footer.IsT0)
            {
                @Footer.AsT0
            }
            else if (Footer.IsT1)
            {
                @Footer.AsT1
            }
        </div>
    </div>
    <div class="ant-transfer-operation">
        <Button Disabled="@(_leftButtonDisabled||Disabled)" Size="@AntSizeLDSType.Small" Icon="left" Type="@ButtonType.Primary" OnClick="@(e=>MoveItem(e,TransferDirection.Left))">@Operations[0]</Button>
        <Button Disabled="@(_rightButtonDisabled||Disabled)" Size="@AntSizeLDSType.Small" Icon="right" Type="@ButtonType.Primary" OnClick="@(e=>MoveItem(e,TransferDirection.Right))">@Operations[1]</Button>
    </div>
    <div class="ant-transfer-list @(Footer.Value!=null?FooterClass:"")" @onscroll="@(e => HandleScroll(TransferDirection.Right, e))" style="@Style">
        <div class="ant-transfer-list-header">
            @if (ShowSelectAll)
            {
                <Checkbox Checked="_rightCheckAllState" Indeterminate="_rightCheckAllIndeterminate " Disabled="@Disabled" CheckedChange="@(checkedState => SelectAll(checkedState, TransferDirection.Right))" />
            }
            <span class="ant-transfer-list-header-selected">
                <span>@_rightCountText items</span>
                @if (Titles[1] != "")
                {
                    <span class="ant-transfer-list-header-title ng-star-inserted">@Titles[1]</span>
                }
            </span>
        </div>
        <div class="ant-transfer-list-body @(ShowSearch?"ant-transfer-list-body-with-search":"")">
            @if (ShowSearch)
            {
                <div class="ant-transfer-list-body-search-wrapper">
                    <div>
                        <Input Class="ant-transfer-list-search" Placeholder="请输入搜索内容" OnInput="@(e=>HandleSearch(e,TransferDirection.Right))" TValue="string" />
                        <span class="ant-transfer-list-search-action">
                            <span role="img" aria-label="search" class="anticon anticon-search">
                                <svg viewBox="64 64 896 896" focusable="false" class="" data-icon="search" width="1em" height="1em" fill="currentColor" aria-hidden="true"><path d="M909.6 854.5L649.9 594.8C690.2 542.7 712 479 712 412c0-80.2-31.3-155.4-87.9-212.1-56.6-56.7-132-87.9-212.1-87.9s-155.5 31.3-212.1 87.9C143.2 256.5 112 331.8 112 412c0 80.1 31.3 155.5 87.9 212.1C256.5 680.8 331.8 712 412 712c67 0 130.6-21.8 182.7-62l259.7 259.6a8.2 8.2 0 0011.6 0l43.6-43.5a8.2 8.2 0 000-11.6zM570.4 570.4C528 612.7 471.8 636 412 636s-116-23.3-158.4-65.6C211.3 528 188 471.8 188 412s23.3-116.1 65.6-158.4C296 211.3 352.2 188 412 188s116.1 23.2 158.4 65.6S636 352.2 636 412s-23.3 116.1-65.6 158.4z"></path></svg>
                            </span>
                        </span>
                    </div>
                </div>
            }
            <ul class="ant-transfer-list-content ng-star-inserted">
                @if (!_rightDataSource.Any())
                {
                    <Empty Image="Empty.PRESENTED_IMAGE_SIMPLE" Small />
                }
                else
                {
                    foreach (var item in _rightDataSource)
                    {
                        <li @key="item" class="ant-transfer-list-content-item ng-star-inserted @(item.Disabled || Disabled ? DisabledClass : "")">
                            <Checkbox Label="@item.Key" Checked="_targetSelectedKeys.Contains(item.Key)" CheckedChange="@(checkedState => SelectItem(checkedState, TransferDirection.Right, item.Key))" Disabled="@(item.Disabled || Disabled)">
                                @if (Render == null)
                                {
                                    @item.Title
                                }
                                else
                                {
                                    var _text = Render(item);
                                    @if (_text.IsT0)
                                    {
                                        @_text.AsT0
                                    }
                                    else
                                    {
                                        @_text.AsT1
                                    }
                                }
                            </Checkbox>
                        </li>
                    }
                }
            </ul>
        </div>
        <div class="ant-transfer-list-footer">
            @if (Footer.IsT0)
            {
                @Footer.AsT0
            }
            else if (Footer.IsT1)
            {
                @Footer.AsT1
            }
        </div>
    </div>
</div>